<%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>


<%
	DestinForm form = (DestinForm)request.getAttribute("command");
	UserInfo user = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	String userName = user.getName();
	String siteId = user.getSiteId();
%>
			<div >
				<form id="destinExcelFORM" name="form" target="coreIframe"
					action="<%=request.getContextPath()%>/destin/doQueryExcel" method="post" enctype="multipart/form-data">
					<div class="breadcrumb">
						<div class="bcIcon"></div>
						<ul class="bcNav">
							<li>解析Excel地址表</li>
						</ul>
					</div>

					<table class="formTable">						
						<tr>
							<td class="tdTitle">Excel文件:</td>
							<td>
									<input type="file" name="excelFile">
									<span class="uploadResultLabel" id="uploadResultLabel" style="display: inline-block;"></span>
									<div>
										<span class="uploadTip">只能处理xls,xlsx格式的Excel文件</span>
									</div>
									<input type="hidden" name="tempFileId" value="">
							</td>
						</tr>
						<tr>
              				<td class="tdTitle">处理进度: </td>
              				<td>
              					<div id="p" class="easyui-progressbar" style="width:300px;"></div>
              				</td>             				
               			</tr>
               			<tr>
							<td class="tdTitle" style="color: red">提示：</td>
							<td><span>批量处理前excel只要一页sheet页，把上传记录放在第一页sheet页。</br>
									表列标题（即第1行）必须是（单号,省份,城市,地区,详细地址）五个列标题不能为空，</br>
									其中单号内容可以为空;</span></td>				
						</tr>
						<input type="hidden" value="11" name="address">
						<input type="hidden" value="11" name="areaname">
						<input type="hidden" name="siteid" value="<%=siteId%>">
						<input type="hidden" name="userid" value="<%=userName%>">				
						<tr>
							<td class="tdTitle"></td>
							<td>
								<div>
									<input id="subbtn" class="input-btn-microsoft" type="submit"  value="批量处理" >
								</div>
							</td>
						</tr>
						
					</table>
				</form>
		</div>
	<iframe name="coreIframe" style="display: none"></iframe>
	<div class="popContainer" id="popContainer" style="display: none;"></div>


<script type="text/javascript">
	$('#p').progressbar();
	$('#subbtn').click(function (){
		var value = $('#p').progressbar('getValue');
		if (value < 100){
			$.ajax({
				url:global.contextPath+"/destin/getQueryCound",
				type:"get",
				data:{},
				dataType:"json",
				success:function(result){
					var queryCount = result.queryCount;
					var queryRunCount = result.queryRunCount;
					var val = (queryRunCount/queryCount).toFixed(2)*100	
					$('#p').progressbar('setValue',val);
				}
			});	
			setTimeout(arguments.callee, 200);
		}
	}); 
	
</script>